﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.BasicData.DTO;
using PowerHub.MES.DTO.BasicData.QueryDto;
using PowerHub.MES.Entities.BasicData;
using PowerHub.MES.IServices.IBasic;
using PowerHub.MES.ReturnEntity;

namespace PowerHub.MES.Controllers.Basic
{

    /// <summary>
    /// 菜单
    /// </summary>
    [ApiController]
    [Route("Api/MES/Basic/[controller]/[action]")]
    public class MenuInfoController
    {

        private IBasicData_MenuInfoServices _MenuInfoServices;

        public MenuInfoController(IBasicData_MenuInfoServices MenuInfoServices)
        {
            _MenuInfoServices = MenuInfoServices;
        }

        /// <summary>
        /// 获取菜单列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取页面菜单列表")]
        public async Task<OperationPageResult<List<BasicData_MenuInfoDTOs>>> GetBasicData_MenuInfoListAsync([FromBody] QueryBasicData_MenuInfoDTO pageQuery)
        {
            return await _MenuInfoServices.GetBasicData_MenuInfoListAsync(pageQuery);
        }

        /// <summary>
        /// 获取选择菜单列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取登录用户菜单列表")]
        public async Task<OperationResult<List<BasicData_MenuInfo>>> GetBasicData_MenuInfoSelectListAsync([FromBody] QueryBasicData_MenuInfoDTO pageQuery)
        {
            return await _MenuInfoServices.GetBasicData_MenuInfoSelectListAsync(pageQuery);
        }


        /// <summary>
        /// 批量删除菜单
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除菜单")]
        public async Task<OperationResult<object>> BatchDeletionBasicData_MenuInfoAsync([FromBody] List<string>  Query)
        {
            return await _MenuInfoServices.BatchDeletionBasicData_MenuInfoAsync(Query);
        }

        /// <summary>
        /// 更新菜单
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [FunctionDescription("更新菜单")]
        [HttpPost]
        public async Task<OperationResult<object>> UpdateBasicData_MenuInfoAsync([FromBody] BasicData_MenuInfoDTO Query)
        {
            return await _MenuInfoServices.UpdateBasicData_MenuInfoAsync(Query);
        }

        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加菜单")]

        public async Task<OperationResult<object>> CreateBasicData_MenuInfoAsync([FromBody] BasicData_MenuInfoDTO Query)
        {
            return await _MenuInfoServices.CreateBasicData_MenuInfoAsync(Query);
        }
    }
}
